<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.news.bean.*" %>
<%@page import="com.news.bean.NewsType;"%>
<%@page import="com.news.util.Pager"%>
<%@page import="com.news.bean.NewsType"%>
<%@page import="com.news.bean.News"%>
<%@page import="com.news.dao.impl.*" %>
<%@page import="com.news.bean.News"%>
<%
            String path = request.getContextPath();
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<LINK href="images/admin_css.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript">
    function upload(id,pic){
        window.showModalDialog('uploadpic.jsp?type=news&id='+id+'&pic='+pic,'ok', 'dialogwidth:380px;dialogheight:300px;help:0;center:1;resizable:0;status:0;scroll:0');
        window.location.reload();
    }
</script>
<%News n = (News) request.getAttribute("ne");%>
<form name="dateform" method="post" action="news?cmd=edit&id=<%=n.getId()%>">
    <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#F2F9FD">
        <tr bgcolor="#D2E8F6">
            <td height="25" colspan="3">&nbsp;&nbsp;<strong>添加信息</strong></td>

        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">标题：</td>
            <td width="450" bgcolor="#FFFFFF"><input name="title" value=<%=n.getTitle()%> type="text" class="input" id="title" size="60" dataType="Require"  msg="请填写信息标题！">
                <font color="red">*</font><font color="gray">信息标题</font><input type="hidden" name="id" id="id" value="<%=n.getId()%>"/></td>
            <td width="600" rowspan="6"><img src="<%=n.getPic()%>" alt="单击修改图片" onerror="this.src='img/nopic.jpg'" onclick="upload('<%=n.getId()%>','<%=n.getPic()%>')" onload="if(this.height>200){this.height=200}" align="middle" /></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">栏目：</td>
            <td bgcolor="#FFFFFF"><select name="sort" id="sort_name_id" dataType="Require"  msg="请选择相关栏目！" >
                    <option selected>请选择新闻内容</option>
                    <%
            List<NewsType> newsTypes = new NewsTypeDaoImpl().list();
            if (newsTypes != null) {
                for (NewsType newstype : newsTypes) {
                    %>
                    <option value="<%=newstype.getId()%>"><font color="#f0f0f0"> ├</font><%=newstype.getName()%></option>
                    <%}
            }%>

                </select>
                <font color="red">*</font> <font color="gray">信息所属的相关栏目</font> </td>

            <td>&nbsp</td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">作者：</td>
            <td bgcolor="#FFFFFF"><input name="writer" value=<%=n.getWriter()%> type="text" class="input" id="writer" dataType="Require"  msg="作者不能为空！">
                <font color="red">*</font> <FONT color=gray>发布信息单位或者摘自单位名称！</FONT></td>
            <td>&nbsp</td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">时间：</td>
            <td valign="middle" bgcolor="#FFFFFF" class="gray"><table width="300" border="0" cellpadding="0" cellspacing="0">
                    <tr valign="middle">
                        <td width="76"><input name="dates" value="<%=n.getDates()%>"  type="text" class="form2" id="dateandtime"  size="10" ></td>
                        <td width="208"></td>
                    </tr>
                </table></td>
            <td>&nbsp</td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">显示：</td>
            <td bgcolor="#FFFFFF"><input name="shows" type="checkbox" id="shows" value="1" >
                <font color="gray">(打&quot;√&quot;则会在网页上面显示，否则只在后台显示)</font></td>

            <td>&nbsp</td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td height="25" align="right" bgcolor="#FFFFFF" class="gray">点击：</td>
            <td valign="middle" bgcolor="#FFFFFF"><input name="hits" type="text" class="input" id="click" value="1" size="10" dataType="Number"  msg="点击次数不能为空，必须为数字！">
                <font color="red">*</font><FONT color=gray>点击次数，默认为1，如需手工填写，填写内容必须为数字！</FONT></td>

            <td>&nbsp</td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="68" height="35" align="right" bgcolor="#FFFFFF" class="gray">新闻内容：</td>
            <td colspan="2"valign="top" bgcolor="#FFFFFF"><textarea name="message" id="message"><%=n.getMessage()%></textarea>
                <script type="text/javascript">
                    CKEDITOR.replace( 'message',
                    {
                        skin: 'v2',
                        toolbar : [ [ 'Bold', 'Italic' ],['NumberedList', 'BulletedList'], [ 'Link','Unlink' ],['Preview'] ]
                    });
                </script></td>

            <td>&nbsp</td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="68" height="35" bgcolor="#FFFFFF" class="gray">&nbsp;</td>
            <td bgcolor="#FFFFFF"><input name="Submit" type="submit" class="button" value=" 提 交 ">
                <input name="Submit" type="reset" class="button" value=" 重 置 ">
                <input name="Submit" type="button" class="button" onclick="history.go(-1);" value=" 返 回 "></td>
        </tr>
    </table>
    <Script type="text/javascript">
        //for init
        try{
            document.dateform.sort.value=<%=n.getSort()%>;
        <%
            if (n.getShows().equalsIgnoreCase("1")) {%>
                    document.dateform.shows.checked=true;
        <% } else {%>
                document.dateform.shows.checked=false;
        <% }%>
            }
            catch(err){
                alert(err.message);
            }

    </Script>
</form>
